﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Account/Site.master" AutoEventWireup="true" CodeFile="ThungRac.aspx.cs" Inherits="Administrator_ThungRac" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
    <style type="text/css">
        .style1
        {
            color: #FF0000;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <asp:SiteMapPath ID="SiteMapPath1" runat="server" Font-Names="Verdana" 
        Font-Size="0.8em" PathSeparator=" : " style="font-size: small">
        <CurrentNodeStyle ForeColor="#333333" />
        <NodeStyle Font-Bold="True" ForeColor="#7C6F57" />
        <PathSeparatorStyle Font-Bold="True" ForeColor="#5D7B9D" />
        <RootNodeStyle Font-Bold="True" ForeColor="#5D7B9D" />
    </asp:SiteMapPath>
    <br />
    <asp:Label ID="Label1" runat="server" 
        style="font-size: x-large; font-weight: 700" Text="Quản lý thùng rác"></asp:Label>
    <br />
    <br />
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" 
        Text="Danh mục" />
&nbsp;
    <asp:Button ID="Button2" runat="server" onclick="Button2_Click" Text="Thể loại" />
&nbsp;
    <asp:Button ID="Button3" runat="server" onclick="Button3_Click"  Visible="false"
        Text="Chức năng" />
&nbsp;
    <asp:Button ID="Button4" runat="server" onclick="Button4_Click" 
        Text="Sản phẩm" />
    <br />
    <asp:MultiView ID="MultiView1" runat="server" ActiveViewIndex="0">
        <asp:View ID="View1" runat="server">
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
                DeleteCommand="UPDATE [NhanHieu] SET Xoa=0 WHERE [ID] = @ID" 
                InsertCommand="INSERT INTO [NhanHieu] ([Ten], [GhiChu]) VALUES (@Ten, @GhiChu)" 
                SelectCommand="SELECT [Ten], [GhiChu], [ID] FROM [NhanHieu] WHERE ([Xoa] = @Xoa)" 
                UpdateCommand="UPDATE [NhanHieu] SET [Ten] = @Ten, [GhiChu] = @GhiChu WHERE [ID] = @ID">
                <DeleteParameters>
                    <asp:Parameter Name="ID" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Ten" Type="String" />
                    <asp:Parameter Name="GhiChu" Type="String" />
                </InsertParameters>
                <SelectParameters>
                    <asp:Parameter DefaultValue="true" Name="Xoa" Type="Boolean" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Ten" Type="String" />
                    <asp:Parameter Name="GhiChu" Type="String" />
                    <asp:Parameter Name="ID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataKeyNames="ID" DataSourceID="SqlDataSource1" EnableModelValidation="True" 
                Width="100%">
                <Columns>
                    <asp:CommandField DeleteText="Khôi phục" ShowDeleteButton="True">
                    <ItemStyle Width="100px" />
                    </asp:CommandField>
                    <asp:BoundField DataField="Ten" HeaderText="Ten" SortExpression="Ten" />
                    <asp:BoundField DataField="GhiChu" HeaderText="GhiChu" 
                        SortExpression="GhiChu" />
                    <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="ID" />
                </Columns>
                <EmptyDataTemplate>
                    Không có rác nhẫn hiệu !
                </EmptyDataTemplate>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <asp:Button ID="Button5" runat="server" onclick="Button5_Click" 
                Text="Xóa vĩnh viễn tất cả nhãn hiệu" />
            <span class="style1"><em>(Tất cả các sản phẩm thuộc danh mục này sẽ bị xóa 
            hết)</em></span><br />
        </asp:View>
        <asp:View ID="View2" runat="server">
            <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataKeyNames="ID" DataSourceID="SqlDataSource2" EnableModelValidation="True" 
                Width="100%">
                <Columns>
                    <asp:CommandField DeleteText="Khôi phục" ShowDeleteButton="True">
                    <ItemStyle Width="100px" />
                    </asp:CommandField>
                    <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="ID" />
                    <asp:BoundField DataField="TenLoai" HeaderText="TenLoai" 
                        SortExpression="TenLoai" />
                    <asp:BoundField DataField="GhiChu" HeaderText="GhiChu" 
                        SortExpression="GhiChu" />
                    <asp:BoundField DataField="SapXep" HeaderText="SapXep" 
                        SortExpression="SapXep" />
                </Columns>
                <EmptyDataTemplate>
                    Không có rác Loại sản phẩm !
                </EmptyDataTemplate>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
                DeleteCommand="UPDATE [Loai] SET Xoa = 0  WHERE [ID] = @ID" 
                InsertCommand="INSERT INTO [Loai] ([TenLoai], [GhiChu], [SapXep]) VALUES (@TenLoai, @GhiChu, @SapXep)" 
                SelectCommand="SELECT [ID], [TenLoai], [GhiChu], [SapXep] FROM [Loai] WHERE ([Xoa] = @Xoa)" 
                UpdateCommand="UPDATE [Loai] SET [TenLoai] = @TenLoai, [GhiChu] = @GhiChu, [SapXep] = @SapXep WHERE [ID] = @ID">
                <DeleteParameters>
                    <asp:Parameter Name="ID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="TenLoai" Type="String" />
                    <asp:Parameter Name="GhiChu" Type="String" />
                    <asp:Parameter Name="SapXep" Type="Int32" />
                </InsertParameters>
                <SelectParameters>
                    <asp:Parameter DefaultValue="true" Name="Xoa" Type="Boolean" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="TenLoai" Type="String" />
                    <asp:Parameter Name="GhiChu" Type="String" />
                    <asp:Parameter Name="SapXep" Type="Int32" />
                    <asp:Parameter Name="ID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <asp:Button ID="Button6" runat="server" onclick="Button6_Click" 
                Text="Xóa vĩnh viễn tất cả loại" />
            <span class="style1"><em>(Tất cả các sản phẩm thuộc loại này sẽ bị xóa hết)</em></span>
        </asp:View>
        <asp:View ID="View3" runat="server">
            <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
                DeleteCommand="UPDATE [ChucNang] SET Xoa = 0  WHERE [ID] = @ID" 
                InsertCommand="INSERT INTO [ChucNang] ([GhiChu], [Ten]) VALUES (@GhiChu, @Ten)" 
                SelectCommand="SELECT [GhiChu], [Ten], [ID] FROM [ChucNang] WHERE ([Xoa] = @Xoa)" 
                UpdateCommand="UPDATE [ChucNang] SET [GhiChu] = @GhiChu, [Ten] = @Ten WHERE [ID] = @ID">
                <DeleteParameters>
                    <asp:Parameter Name="ID" Type="Int32" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="GhiChu" Type="String" />
                    <asp:Parameter Name="Ten" Type="String" />
                </InsertParameters>
                <SelectParameters>
                    <asp:Parameter DefaultValue="true" Name="Xoa" Type="Boolean" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="GhiChu" Type="String" />
                    <asp:Parameter Name="Ten" Type="String" />
                    <asp:Parameter Name="ID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
            <asp:GridView ID="GridView3" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataKeyNames="ID" DataSourceID="SqlDataSource3" EnableModelValidation="True" 
                Width="100%">
                <Columns>
                    <asp:CommandField DeleteText="Khôi phục" ShowDeleteButton="True">
                    <ItemStyle Width="100px" />
                    </asp:CommandField>
                    <asp:BoundField DataField="GhiChu" HeaderText="GhiChu" 
                        SortExpression="GhiChu" />
                    <asp:BoundField DataField="Ten" HeaderText="Ten" SortExpression="Ten" />
                    <asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" 
                        ReadOnly="True" SortExpression="ID" />
                </Columns>
                <EmptyDataTemplate>
                    Không có rác chức năng !
                </EmptyDataTemplate>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <br />
            <asp:Button ID="Button7" runat="server" onclick="Button7_Click" 
                Text="Xóa vĩnh viễn tất cả chức năng" />
            <span class="style1"><em>(Tất cả các sản phẩm có chứcn ăng này sẽ bị xóa hết)</em></span>
        </asp:View>
        <asp:View ID="View4" runat="server">
            <asp:GridView ID="GridView4" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataKeyNames="MaSanPham" DataSourceID="SqlDataSource4" EnableModelValidation="True" 
                Width="100%">
                <Columns>
                    <asp:CommandField DeleteText="Khôi phục" ShowDeleteButton="True">
                    <ItemStyle Width="100px" />
                    </asp:CommandField>
                    <asp:BoundField DataField="TenChucNang" HeaderText="TenChucNang" 
                        SortExpression="TenChucNang" />
                    <asp:BoundField DataField="MaSanPham" HeaderText="MaSanPham" 
                        SortExpression="MaSanPham" ReadOnly="True" />
                    <asp:BoundField DataField="GiaBan" HeaderText="GiaBan" 
                        SortExpression="GiaBan" />
                    <asp:BoundField DataField="TenNhanHieu" HeaderText="TenNhanHieu" 
                        SortExpression="TenNhanHieu" />
                    <asp:BoundField DataField="TenTheLoai" HeaderText="TenTheLoai" 
                        SortExpression="TenTheLoai" />
                </Columns>
                <EmptyDataTemplate>
                    Không có rác sản phẩm !
                </EmptyDataTemplate>
                <FooterStyle BackColor="White" ForeColor="#000066" />
                <HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
                <RowStyle ForeColor="#000066" />
                <SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
            <br />
            <asp:Button ID="Button8" runat="server" onclick="Button8_Click" 
                Text="Xóa vĩnh viễn tất cả sản phẩm" />
            <span class="style1"><em>(Tất cả các sản phẩm&nbsp; này sẽ bị xóa vĩnh viễn không 
            khôi phục được nữa)</em></span><asp:SqlDataSource ID="SqlDataSource4" runat="server" 
                ConnectionString="<%$ ConnectionStrings:ConnectServer %>" 
                DeleteCommand="UPDATE [SanPham] SET Xoa = 0  WHERE [MaSanPham] = @MaSanPham" 
                InsertCommand="INSERT INTO [ChucNang] ([Ten], [GhiChu]) VALUES (@Ten, @GhiChu)" 
                SelectCommand="SELECT ChucNang.Ten AS TenChucNang, SanPham.MaSanPham, SanPham.GiaBan, SanPham.NgayCapNhat, SanPham.LoaiID, SanPham.Xoa, SanPham.GioiThieu, SanPham.ChucNangID, SanPham.NhanHieuID, NhanHieu.Ten AS TenNhanHieu, Loai.TenLoai AS TenTheLoai FROM ChucNang RIGHT OUTER JOIN SanPham ON ChucNang.ID = SanPham.ChucNangID INNER JOIN Loai ON SanPham.LoaiID = Loai.ID INNER JOIN NhanHieu ON SanPham.NhanHieuID = NhanHieu.ID WHERE (SanPham.Xoa = 1)" 
                
                UpdateCommand="UPDATE [ChucNang] SET [Ten] = @Ten, [GhiChu] = @GhiChu WHERE [ID] = @ID">
                <DeleteParameters>
                    <asp:Parameter Name="MaSanPham" />
                </DeleteParameters>
                <InsertParameters>
                    <asp:Parameter Name="Ten" Type="String" />
                    <asp:Parameter Name="GhiChu" Type="String" />
                </InsertParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Ten" Type="String" />
                    <asp:Parameter Name="GhiChu" Type="String" />
                    <asp:Parameter Name="ID" Type="Int32" />
                </UpdateParameters>
            </asp:SqlDataSource>
        </asp:View>
    </asp:MultiView>
    <br />
</asp:Content>

